<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>

<body>
	<script>
		var obj = {
			id: 1,
			name: 'jack',
			age: 19
		}


		var arr = []
		//  for   in  是循环对象
		for (const key in obj) {
			//console.log(key, obj[key]);
			var str = key + '=' + obj[key] //   id=1   name=jack
			arr.push(str)
		}
		//console.log(arr.join('&')); //  [id=1,name=jack]


		/* Object.keys() */
		var newArr = Object.keys(obj)
		console.log(newArr, 9999);


		/* for  of */
		var arr2 = [{
			id: 1,
			name: 'jack'
		}, {
			id: 2,
			name: 'rose'
		}]
		for (const item of arr2) {
			console.log(item, 777);
		}
	</script>
</body>

</html>
